﻿Public Class myQuestions
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'Redirects to own questions as default
        If Request.Params("author") = "" Then Response.Redirect("myQuestions.aspx?author=" & User.Identity.Name)


        'Super users can edit anyone's questions
        If Not User.IsInRole("superuser") Then
       
            'Prevents from visiting others' questions
            If Not Request.Params("author") = User.Identity.Name Then Response.Redirect("myQuestions.aspx?author=" & User.Identity.Name)

            'Hides edit column if questions are not owned by user
            If Request.Params("author") = User.Identity.Name Then
                GridView1.Columns(6).Visible = True
            Else
                GridView1.Columns(6).Visible = False
            End If

        End If

    End Sub

End Class